import website from "@/config/website";
import {SYSTEM_PREFIX} from "@/store/constant";

const DIC = {
  sex: [{
    label: "男",
    value: 1
  }, {
    label: "女",
    value: 2
  }, {
    label: "未知",
    value: 3
  }]
}

export const tableOption = {
  height: 'auto',
  calcHeight: 210,
  searchShow: true,
  searchMenuSpan: 6,
  tip: false,
  border: true,
  index: true,
  selection: true,
  addBtn: false,
  viewBtn: true,
  column: [
    {
      label: "登录账号",
      prop: "account",
      search: true,
      rules: [{
        required: true,
        message: "请输入登录账号",
        trigger: "blur"
      }],
      span: website.tenantMode ? 12 : 24,
    },
    {
      label: "所属租户",
      prop: "tenantId",
      type: "tree",
      dicUrl: SYSTEM_PREFIX + "/tenant/select",
      props: {
        label: "tenantName",
        value: "tenantId"
      },
      hide: !website.tenantMode,
      addDisplay: website.tenantMode,
      editDisplay: website.tenantMode,
      viewDisplay: website.tenantMode,
      search: false,
      rules: [{
        required: true,
        message: "请输入所属租户",
        trigger: "click"
      }]
    },
    {
      label: '密码',
      prop: 'password',
      hide: true,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: '确认密码',
      prop: 'password2',
      hide: true,
      editDisplay: false,
      viewDisplay: false,
    },
    {
      label: "用户昵称",
      prop: "name",
      rules: [{
        required: true,
        message: "请输入用户昵称",
        trigger: "blur"
      }]
    },
    {
      label: "用户姓名",
      prop: "realName",
      search: true,
      rules: [{
        required: true,
        message: "请输入用户姓名",
        trigger: "blur"
      }]
    },
    {
      label: "所属角色",
      prop: "roleId",
      multiple: true,
      type: "tree",
      dicData: [],
      props: {
        label: "title"
      },
      slot: true,
      checkStrictly: true,
      rules: [{
        required: true,
        message: "请选择所属角色",
        trigger: "click"
      }]
    },
    {
      label: "所属部门",
      prop: "deptId",
      type: "tree",
      multiple: true,
      dicData: [],
      props: {
        label: "title"
      },
      slot: true,
      checkStrictly: true,
      rules: [{
        required: true,
        message: "请选择所属部门",
        trigger: "click"
      }]
    },
    {
      label: "用户编号",
      prop: "code",
      hide: true,
    },
    {
      label: "所属岗位",
      prop: "postId",
      type: "tree",
      multiple: true,
      dicData: [],
      hide: true,
      props: {
        label: "postName",
        value: "id"
      },
      rules: [{
        required: true,
        message: "请选择所属岗位",
        trigger: "click"
      }],
    },
    {
      label: "手机号码",
      prop: "phone",
      overHidden: true
    },
    {
      label: "电子邮箱",
      prop: "email",
      hide: true,
      overHidden: true
    },
    {
      label: "用户性别",
      prop: "sex",
      type: "select",
      dicData: DIC.sex,
      hide: true
    },
    {
      label: "用户生日",
      type: "date",
      prop: "birthday",
      format: "yyyy-MM-dd hh:mm:ss",
      valueFormat: "yyyy-MM-dd hh:mm:ss",
      hide: true
    },
    {
      label: "账号状态",
      prop: "statusName",
      hide: true,
      display: false
    }
  ]
}

export const excelOption = {
  submitBtn: false,
  emptyBtn: false,
  column: [
    {
      label: '模板上传',
      prop: 'excelFile',
      type: 'upload',
      drag: true,
      loadText: '模板上传中，请稍等',
      span: 24,
      propsHttp: {
        res: 'data'
      },
      tip: '请上传 .xls,.xlsx 标准格式文件',
      action: "/api/blade-user/import-user"
    },
    {
      label: '模板下载',
      prop: 'excelTemplate',
      formslot: true,
      span: 24,
    }
  ]
}
